package spring.spring_aop.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;


@Slf4j
@Aspect
@Component
@Order(1)
public class runTimeAspect3 {
    @Pointcut("execution(* spring.spring_aop.controller.*.*(..))")
    public void pt() {
    }

    @Before("pt()")
    public void before(JoinPoint joinPoint) {
        log.info("方法执行之前- t3 -" + joinPoint.getSignature().getName());
    }

    //有无异常都执行
    @After("pt()")
    public void after(JoinPoint joinPoint) {
        log.info("方法执行之后- t3 -" + joinPoint.getSignature().getName());
    }
}
